package cn.tedu;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class JDBC_Utils {
    public static  void close(Connection conn, PreparedStatement ps, ResultSet rs){
       if (rs != null){
           try {
               rs.close();
           }catch (Exception e){
               e.printStackTrace();
           }finally {
               rs = null;
           }
       }
        if (ps != null) {
            try {//释放资源
                ps.close();
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                ps = null;
            }
        }
        if (conn != null) {
            try {//释放资源
                conn.close();
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                conn = null;
            }
        }
    }
}
